<link rel="stylesheet" href="../core/resource/weui/weui.css">
<div class="order-list-page" ng-if="pagedata.op == 'list'">
    <div class="fui-header">
		<div class="fui-header-left" ng-click="goback()">
            <a class="back"></a>
        </div>
		<div class="title">我的订单</div>
		<div class="fui-header-right"></div>
	</div>
	<div style="margin-top:58px"></div>
	<div id="tab" class="fui-tab fui-tab-danger">
 
        <a ng-class="{'external active':pagedata.status == 0}" href="javascript:" ng-click="access_json('list','status=0')">待付款</a>
        <a ng-class="{'external active':pagedata.status == 1}" href="javascript:" ng-click="access_json('list','status=1')">待发货</a>
        <a ng-class="{'external active':pagedata.status == 2}" href="javascript:" ng-click="access_json('list','status=2')">已发货</a>
        <a ng-class="{'external active':pagedata.status == 3}" href="javascript:" ng-click="access_json('list','status=3')">已收货</a>
        <a ng-class="{'external active':pagedata.status == 4}" href="javascript:" ng-click="access_json('list','status=4')">已完成</a>
    </div>
	<div class='fui-content order-list' style="margin-top: 4.2rem;">
	<div class="fui-list-group order-item" ng-repeat="item in pagedata.list">
                <a class="fui-list external" style="padding: 0.42rem 0.5rem" data-nocache="true">
                    <div class="fui-list-inner">
                        <div class="subtitle"> 订单号: {{item.ordersn}}</div>
                    </div>
                    <div ng-show="item.status==0" class="row-remark text-cancel" style="width: 4rem; font-size: 0.65rem;text-align: right;">待付款</div>
                    <div ng-show="item.status==1" class="row-remark text-cancel" style="width: 4rem; font-size: 0.65rem;text-align: right;">待发货</div>
                    <div ng-show="item.status==2" class="row-remark text-cancel" style="width: 4rem; font-size: 0.65rem;text-align: right;">已发货</div>
                    <div ng-show="item.status==3" class="row-remark text-cancel" style="width: 4rem; font-size: 0.65rem;text-align: right;">已收货</div>
                    <div ng-show="item.status==4" class="row-remark text-cancel" style="width: 4rem; font-size: 0.65rem;text-align: right;">已完成</div>
                    <div class="angle"></div>
                </a> 
                    <a href="" data-nocache="true">
                        <div class="fui-list-group-title lineblock">
                            <i class="icon jinyunicon icon-dianpu"></i> {{item.act.title}}
                            <span class="status noremark" style="font-size:0.50rem">商品名称：<span style="color:#f60;">{{item.goods.title}}</span></span>
                        </div>
                    </a>
                    <a href="" class="external" data-nocache="true" ng-click="access_json('/order/detail/id='+item.id)">
                        <div class="fui-list goods-list">
                            <div class="fui-list-media" style="">
                                <img class="" ng-src="{{tomedia(item.image) || '../core/resource/images/nopic.jpg'}}">
                            </div>
                            <div class="fui-list-inner">
                                <div class="text goodstitle towline"></div>
                            </div>
                           
							<div class='fui-list-angle'>
								<span class='marketprice'>
								价格：{{price(item.price/item.num*100)}}
								<br/>   x {{item.num}}件
								</span>
							</div>
                        </div>
                    </a>
                <div class="fui-list-group-title lineblock">
					<span  style="color:#999;font-size:0.55rem"><i class="icon jinyunicon icon-shijian" style="color:#f60;font-size:0.50rem"></i> {{item.createtime}}</span>
					
                    <span class="status noremark">共计： <span>&yen;{{item.price}}</span>{{ifelse(item.ispay==1,'实付:','')}}<span class="text-danger">{{ifelse(item.ispay==1,'￥'+item.price,'待支付')}}</span></span>
                </div>
            <div class="fui-list-group-title lineblock opblock">
				<span class="status noremark">
					<div ng-show="item.status == 0" class="btn btn-sm btn-default-o order-delete" href="javascript:" ng-click="post({},'del','id='+item.id)">删除订单</div>
					<div ng-show="item.status == 0" class="btn btn-sm btn-danger-o order-finish" ng-click="pagedata.pay(item.id)">支付订单</div>
					<div ng-show="item.status == 2" class="btn btn-sm btn-danger-o order-finish" href="javascript:" ng-click="post({},'receive','id='+item.id)">确认收货</div>
				</span>
            </div>
        </div>
	</div>
	<div class="content-empty" ng-show="pagedata.list.length == 0 ">
		  <i class="icon jinyunicon icon-cry" style="width: 6rem;margin-bottom: 0.5rem;"></i><br/><p style="color: #999;font-size: .75rem">您暂时没有订单！</p>
	</div>
</div>
<div class="order-list-page" ng-if="pagedata.op == 'detail'">
    <div class="fui-header">
		<div class="fui-header-left" ng-click="goback()">
            <a class="back"></a>
        </div>
		<div class="title">订单详情</div>
		<div class="fui-header-right"></div>
	</div>
	<div class='fui-content member-page'>
		<div class="fui-list-group merchgroup">
			<div class="fui-list jump">
                <a class="fui-list-media">
                    <img class="round" src="{{tomedia(pagedata.member.avatar) || '../core/resource/images/nopic.jpg'}}" />
                </a>
                <div class="fui-list-inner">
                    <!--<div class="title">{{pagedata.user.name || '匿名用户'}}</div>
					<div class="title" style="font-size:0.65rem">手机号：{{pagedata.user.mobile}}</div> -->
					<div class="title" style="font-size:0.65rem">昵称：{{pagedata.member.nickname}}</div>
					
                </div>
                <a class="jump" href="javascript:;">
					
				</a>
            </div>
		</div>
		<div class="weui_cells">
			<div class="weui_cell">
					<div class="weui_cell_bd weui_cell_primary">
						<span>活动名称</span>
					</div>
					<div class="weui_cell_ft" ng-model="">{{pagedata.order.act.title}}</div>
			</div>
			<div class="weui_cell">
					<div class="weui_cell_bd weui_cell_primary">
						<span>商品名称</span>
					</div>
					<div class="weui_cell_ft" ng-model="">{{pagedata.order.goods.title}}</div>
			</div>
			<div class="weui_cell">
					<div class="weui_cell_bd weui_cell_primary">
						<span>订单状态</span>
					</div>
					<div class="weui_cell_ft" ng-model="">{{pagedata.zhuangtai}}</div>
			</div>
			<div ng-if="pagedata.order.status>1" class="weui_cell">
					<div class="weui_cell_bd weui_cell_primary">
						<span>快递</span>
					</div>
					<div class="weui_cell_ft" ng-model="">{{pagedata.order.express.name}}</div>
			</div>
			<div ng-if="pagedata.order.status>1"  class="weui_cell">
					<div class="weui_cell_bd weui_cell_primary">
						<span>快递单号</span>
					</div>
					<div class="weui_cell_ft" ng-model="">{{pagedata.order.express.expresssn}}</div>
			</div>
			<div class="weui_cell">
					<div class="weui_cell_bd weui_cell_primary">
						<span>联系人姓名</span>
					</div>
					<div class="weui_cell_ft" ng-model="">{{pagedata.order.address.name}}</div>
			</div>
			<div class="weui_cell">
					<div class="weui_cell_bd weui_cell_primary">
						<span>联系电话</span>
					</div>
					<div class="weui_cell_ft" ng-model="">{{pagedata.order.address.mobile}}</div>
			</div>
			<div class="weui_cell">
					<div class="weui_cell_bd weui_cell_primary">
						<span>地址</span>
					</div>
					<div class="weui_cell_ft" ng-model="">{{pagedata.order.address.address}}</div>
			</div>
			<div class="weui_cell">
					<div class="weui_cell_bd weui_cell_primary">
						<span>总价</span>
					</div>
					<div class="weui_cell_ft" ng-model="">{{pagedata.order.price}}元</div>
			</div>

		</div>
	</div>
</div>
<div ng-include="sys_html('_footer')"></div>
<script type="text/javascript">
	scope.pagedata.pay=function(id){
	var params={
		data:{'id':id},
		op:'pay',
		callback:function(res){
			if(res.payid){
				require(['tool'],function(tool){
					tool.pay(res.payid,function(re){
						if(re.type=='success'){
							scope.message('支付成功！','','jy_weishop_cutprice/order//status=1');
							
						}else{
							scope.message('支付失败！失败原因：'+re.message,'error');
						}
					});
				});
			}
		}
	};
	scope.post_json(params);

}
</script>
